import { Switch, BrowserRouter as Router, Route, Link } from 'react-router-dom';

import HomePage from '../pages/home';
import LoginPage from '../pages/login';
import UserPage from '../pages/user';
import NotFoundPage from '../pages/not-found';
import PrivateRoute from './PrivateRoute';

export default function Routes(props) {
  return (
    <Router>
      <Link to="/">首页</Link>
      <Link to="/user">用户</Link>
      <Link to="/login">登录</Link>

      <Switch>
        <Route component={HomePage} exact path="/" />
        <Route component={LoginPage} path="/login" />
        <PrivateRoute component={UserPage} path="/user" />
        <Route component={NotFoundPage} />
      </Switch>
    </Router>
  );
}
